<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<form name="a">
    <input type="radio" name="b[大小][]" value="大" checked="checked"/>大
    <input type="radio" name="b[大小][]" value="小" />小
    <input type="checkbox" name="b[颜色][]" value="红" />红
    <input type="checkbox" name="b[颜色][]" value="绿" checked="checked"/>绿
    <input type="checkbox" name="b[风格][]" value="中式" checked="checked"/>中式
    <input type="checkbox" name="attr[赠品][]" value="手机挂件">
</form>

<script type="text/javascript">







   var input = document.getElementsByTagName('input');
   var t = [];
   var t1 = [];
   var t2 = [];
   for(var i=0;i<input.length;i++) {
       if(input[i].name.indexOf('[]') != -1) {
           t.push(input[i]);
       }
   }
   for(var i=0;i<t.length;i++) {
       if(t[i].checked && t[i].type == 'radio') {
         var a = t[i].name.substring(t[i].name.indexOf('[')+1,t[i].name.indexOf(']'));
         t1.push(a);
         t2.push(t[i].value);
       } else if(t[i].checked && t[i].type == 'checkbox') {
           var a = t[i].name.substring(t[i].name.indexOf('[')+1,t[i].name.indexOf(']'));
           t1.push(a);
           t2.push(t[i].value);
       }
   }

   alert(t1);
   alert(t2);


</script>